#pragma once
#include "Vector3.h"
#define PI 3.1415926535f
#include "Matrix.h"
#include "NBE.h"
#include "Listener.h"
namespace NBE
{
	class NBE_API Camera: public Listener
	{
	public:
		Camera();
		virtual void handleEvent(Event* e);
		void handleKeyDown(int key);
		void setPosition(const vec3f& position){m_pos = position;}
		//void setDirection(const vec3f& direction){m_direction = direction;}
		void applyImpulse(const vec3f& impulse);
		void applyWorldBasisImpulse(const vec3f& worldImpulse);
		const vec3f& getRotation();//degree
		const vec3f& setRotation(const vec3f& rotation);
		void rotate(const vec3f& change);
		void setViewTransformation();
		
		const vec3f& getDirection();
		

		//vec3f& getOffset(){return m_offset;}
		void changeKeyBoardImpulseScale(float s){KEY_BOARD_IMPULSE_SCALAR = s;}
		void moveTo( vec3f& worldPos );
		void updatePos();
		void updateViewMatrix();
		Matrix4f setProjection(float fov, float aspect,float znear, float zfar);

		inline vec3f& getUp(){return m_up;}
		//camera up
		inline vec3f& getPosition(){return m_pos;}
		inline Matrix4f getProjection(){return m_projection;}
		inline Matrix4f getViewMatrix(){return m_view;}
	private:
		vec3f m_pos;
		vec3f m_velocity;
		vec3f m_rotation;
		float m_drag;
		vec3f m_direction;
		vec3f m_up;

		// 		vec3f m_offset;//camera chase
		// 		const vec3f m_const_offsetValue;
		// 		vec3f m_targetRotation;// LERP to the 3rd person


		Matrix4f m_view;
		Matrix4f m_projection;

		float KEY_BOARD_IMPULSE_SCALAR;
	};
}